/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:${USER}
 * Date:${YEAR}-${MONTH}-${DAY}
 * ${TIME}
 */
import java.util.*;

class Main{
    static int count=0;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        int len=s.length();
        for(int i=0;i<len;i++){
            String ss=s.substring(i,len);
            add(ss);
        }
        System.out.print(count);
    }
    public static void add(String ss){

        int len1=ss.length();
        for(int j=len1;j>0;j--){
            Set<Character> set=new HashSet<>();
            String sss=ss.substring(0,j);
            int len2=sss.length();
            for(int i=0;i<len2;i++){
                Character c=sss.charAt(i);
                if(!set.contains(c)){
                    set.add(c);
                }else{

                }
            }
            count+=set.size();
        }
    }
}